package org.cvcsc.weproject.controller.dto;

import java.util.List;
import java.util.stream.Collectors;

import org.cvcsc.weproject.domain.StudentNameNumber;

public class RequestDtoImportStudentsForClazz {
    private List<StudentDto> students;

    public List<StudentDto> getStudents() {
        return students;
    }

    public void setStudents(List<StudentDto> students) {
        this.students = students;
    }

    public static class StudentDto {
        private String name;
        private String number;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getNumber() {
            return number;
        }

        public void setNumber(String number) {
            this.number = number;
        }
    }

    public List<StudentNameNumber> getListOfStudentNameAndNumber() {
        return students.stream()
                .map(studentDto -> new StudentNameNumber(studentDto.getName(), studentDto.getNumber()))
                .collect(Collectors.toList());
    }
}